

use "$data/clean/clean_main_complete.dta" , replace

		   
loc experiments "any_doors doors_wins "

		   
		   
preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' `experiments'{

    loc ++columns
    qui eststo col`columns': reg x y

}

restore


/* Statistics */

loc colnum = 1
loc colnames ""


foreach choice in `experiments' {

/* Statistics */



 
 
********************************Panel A*****************************************
	
 xi: reg `choice'  int_doortodoor  if control==0 , vce(r) // 
   
   
   
    sigstar int_doortodoor , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
		 
	qui sum `choice' if control==0
	estadd loc thisstat6 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' if control==0
    estadd loc thisstat7 = string(`r(N)', "%9.0f"): col`colnum'
	
	
 xi: reg `choice'  int_doortodoor  if control==1, vce(r) // 
   

      loc ++colnum
   
    sigstar int_doortodoor  , prec(3)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
   
		 
	qui sum `choice' if control==1
	estadd loc thisstat6 = string(`r(mean)', "%9.2f"): col`colnum'
	
	qui sum `choice' if control==1
    estadd loc thisstat7 = string(`r(N)', "%9.0f"): col`colnum'	
	

 xi: reg `choice'  1.int_doortodoor##1.control   , vce(r) // 
 
 test 1.int_doortodoor#1.control 
 	estadd loc thisstat8 = string(`r(p)', "%9.2f"): col`colnum'
	
    loc ++colnum

	}
	

	 

loc rowlabels " " " "  " "Intention: Any canvassing" " " "  "  "\hline Group outcome mean" "Number of Observations" "p-value(control=treatment)" "

loc rowstats ""

forval i = 1/8 {
    loc rowstats "`rowstats' thisstat`i'"
}



esttab col* using "$output/corr_doors_int_bytreat.tex", replace cells(none) booktabs nonotes compress alignment(c)  nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
  mgroups("Any door"  "Doors (wins)",  pattern(1 0 1 0 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))   mtitle("Treatment" "Control" "Treatment" "Control" )


